package com.dnjn.happiness.survey.controller.admin;


import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dnjn.happiness.survey.controller.common.CommonCheckItemController;
import com.dnjn.happiness.survey.domain.CheckItem;
import com.dnjn.happiness.survey.domain.vo.CheckItemVO;
import com.dnjn.happiness.common.log.annotation.Log;
import com.dnjn.happiness.common.log.enums.BusinessType;
import com.dnjn.happiness.common.core.utils.bean.BeanUtils;
import com.dnjn.happiness.common.core.utils.poi.ExcelUtil;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.dnjn.happiness.common.security.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;


/**
 * 考核Controller
 *
 * @author happiness
 * @date 2024-04-07
 */
@Tag(name = "check admin item 考核" , description = "考核" )
@RestController
@RequestMapping("/admin/check/item" )
public class AdminCheckItemController extends CommonCheckItemController {
    /**
     * 导出考核列表
     */
    @Log(title = "考核" , businessType = BusinessType.EXPORT)
    @RequiresPermissions("@ss.hasPermi('check:item:export')" )
    @PostMapping("/export" )
    public void export(HttpServletResponse response, CheckItemVO vo) {
        CheckItem checkItem=new CheckItem();
        BeanUtils.copyPropsIgnoreNull(vo,checkItem);

        List<CheckItem> list = checkItemService.list(Wrappers.query(checkItem));
        ExcelUtil<CheckItem> util = new ExcelUtil<CheckItem>(CheckItem. class);
        util.exportExcel(response, list, "考核数据" );
    }

}
